 
int maxArea(int* height, int heightSize) {
    int left=0;
    int right=heightSize-1;
    int sum=0;
    int max=-1;
    while(left<right)
    {
        if(height[left]<height[right])
        {
            
            sum=(right-left)*height[left];
            
            int t=left;
            left++;
            while(height[left]<=height[t])
                left++;
        }
        else
        {
            sum=(right-left)*height[right];
            int k=right;
            right--;
            while(height[right]<height[k])
                right--;
        }
        if(sum>max)
            max=sum;
    }
    return max;
}